<?php

namespace App\Model;

use Hyperf\Database\Model\Relations\BelongsTo;

/**
 * 退款记录
 */
class RefundLog extends Model
{
    public bool $timestamps = true;
    protected ?string $table = 'refund_log';

    protected array $guarded = [];
    public function order():BelongsTo
    {
        return $this->belongsTo(Order::class, 'number', 'number');
    }


    public function notifySomething(){
        switch ($this->refund_type){
            case 2:
                $this->order->addBill(-$this->reject_amt);
                break;
            case 3:
                $this->order->user->refundService($this->order->service_fee);
                break;
            default:
                break;
        }

    }

}
